<nz-card>
  <nz-descriptions
    nzTitle="售后单信息"
    [nzSize]="descriptionSize"
    [nzColumn]="descriptionColumn"
    nzBordered
  >
    <nz-descriptions-item nzTitle="售后单号">
      {{ detailsData.returnNum || '-' }}
      <i
        *ngIf="detailsData.returnNum"
        nz-icon
        nzType="copy"
        nzTheme="outline"
        nz-tooltip
        nzTooltipTitle="点击复制"
        (click)="copyContent(detailsData.returnNum)"
      ></i>
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="售后方式">
      {{ detailsData.type | secondSaleAfterMode: 'label' }}
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="状态">
      <span [ngStyle]="{'color': detailsData.status | secondSaleAfterStatus: 'color'}">
        {{ detailsData.status | secondSaleAfterStatus: 'label' }}
      </span>
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="申请时间">
      {{ detailsData?.createTime || '-' }}
    </nz-descriptions-item>
    
    <nz-descriptions-item nzTitle="超时时间">
      <div
        *ngIf="deadlineVisible;else templateTme"
        [ngStyle]="{'color': differDateColor}"
      >
        {{ detailsData?.timeoutTime || '-' }}
        <p class="overtime-p">
          (
            <nz-countdown
              [nzValue]="deadlineTime"
              [nzFormat]="'剩余 D 天 H 时 m 分 s 秒'"
              [nzValueStyle]="{
                'font-size': '14px',
                'color': differDateColor
              }"
              (nzCountdownFinish)="loadDetailsData()"
            ></nz-countdown>
          )
        </p>
      </div>
      <ng-template #templateTme>-</ng-template>
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="用户寄回物流">
      <ng-container *ngIf="detailsData?.express?.expressNum;else templateWl1">
        {{ detailsData?.express?.expressNum }}（{{ detailsData?.express?.expressName }}）

        <i
          *ngIf="detailsData?.express?.expressNum"
          nz-icon
          nzType="copy"
          nzTheme="outline"
          nz-tooltip
          nzTooltipTitle="点击复制"
          (click)="copyContent(detailsData?.express?.expressNum)"
        ></i>
        <button
          nz-button
          nzType="link"
          nzSize="small"
          (click)="showLogisticsDetailModal(detailsData?.express)"
        >查看物流</button>
      </ng-container>
      <ng-template #templateWl1>
        待填写
      </ng-template>
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="拒绝售后物流">
      <ng-container *ngIf="detailsData?.refundExpress?.expressNum;else templateWl2">
        {{ detailsData?.refundExpress?.expressNum }}（{{ detailsData?.refundExpress?.expressName }}）
        
        <i
          nz-icon
          nzType="copy"
          nzTheme="outline"
          nz-tooltip
          nzTooltipTitle="点击复制"
          (click)="copyContent(detailsData?.refundExpress?.expressNum)"
        ></i>

        <button
          nz-button
          nzType="link"
          nzSize="small"
        >查看物流</button>
      </ng-container>
      <ng-template #templateWl2>待填写</ng-template>
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="售后出库单">
      <ng-container *ngIf="detailsData?.deliveryNumber; else afterTemplate">
        <a
          style="color: #1890ff;"
          target="_blank"
          routerLink="/used-store/usedOutDetail"
          [queryParams]="{id: detailsData?.deliveryId}"
        >
          {{ detailsData?.deliveryNumber }}
        </a>
      </ng-container>
      <ng-template #afterTemplate>
        -
      </ng-template>
    </nz-descriptions-item>

    <nz-descriptions-item nzTitle="退款原因">
      {{ detailsData?.note || '-' }}
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="退款备注">
      {{ detailsData?.desc || '-' }}
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="退款附件">
      <nz-image-group class="detail-imgs" *ngIf="detailsData?.imgs">
        <ng-container *ngFor="let img of getImgArray(detailsData.imgs)">
          <span class="detail-imgs-item">
            <img
              nz-image
              width="40px"
              height="40px"
              [nzSrc]="img"
              alt=""
            />
          </span>
        </ng-container>
      </nz-image-group>
    </nz-descriptions-item>
  </nz-descriptions>
</nz-card>

<nz-card class="m-t-4">
  <nz-descriptions
    nzTitle="订单信息"
    [nzSize]="descriptionSize"
    [nzColumn]="descriptionColumn"
    nzBordered
  >
    <nz-descriptions-item nzTitle="订单编号">
      <a
        nz-button
        nzType="link"
        nzSize="small"
        style="padding: 0;"
        target="_blank"
        routerLink="/used-store/usedOrderDetails"
        [queryParams]="{id: detailsData?.order?.orderId}"
      >
        {{ detailsData?.order?.orderNum || '-' }}
      </a>

      <i
        *ngIf="detailsData?.order?.orderNum"
        nz-icon
        nzType="copy"
        nzTheme="outline"
        nz-tooltip
        nzTooltipTitle="点击复制"
        (click)="copyContent(detailsData?.order?.orderNum)"
      ></i>
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="状态">
      <span [ngStyle]="{'color': detailsData?.order?.status | orderStatus: 'color'}">
        {{ detailsData?.order?.status | orderStatus: 'text' }}
      </span>
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="下单时间">
      {{ detailsData?.order?.createTime || '-' }}
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="付款时间">
      {{ detailsData?.order?.payTime || '-' }}
    </nz-descriptions-item>

    <nz-descriptions-item nzTitle="发货单号">
      <ng-container *ngIf="detailsData?.order?.express?.expressNum;else templateDh">
        {{ detailsData?.order?.express?.expressNum }}
        （{{ detailsData?.order?.express?.expressName }}）

        <button
          nz-button
          nzType="link"
          nzSize="small"
          (click)="showLogisticsDetailModal(detailsData?.order?.express)"
        >查看物流</button>
      </ng-container>
      <ng-template #templateDh>-</ng-template>
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="付款交易单号">
      {{ detailsData?.order?.payOrderNum || '-' }}
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="订单总额">
      ￥ {{ (detailsData?.order?.realPrice || 0) + (detailsData?.order?.aiDouAmount || 0) }}元
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="支付方式">
      <p style="color: #ff4d4f;">
        <span *ngIf="detailsData?.order?.realPrice">
          <ng-container [ngSwitch]="detailsData?.order?.payType">
            <i *ngSwitchCase="1">支付宝</i>
            <i *ngSwitchCase="2">微信</i>
            <i *ngSwitchDefault>-</i>
          </ng-container>
          {{ detailsData?.order?.realPrice }}元，
        </span>

        <span *ngIf="detailsData?.order?.aiDouAmount || detailsData?.order?.aiDouAmount == 0">
          爱豆 {{ detailsData?.order?.aiDouAmount }}
        </span>
      </p>
    </nz-descriptions-item>

    <nz-descriptions-item nzTitle="订单售后次数">
      {{ detailsData?.order?.afterSaleCount }}次（成功{{ detailsData?.order?.afterSaleSuccessCount }}次）
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="用户售后次数">
      {{ detailsData?.order?.afterSaleTotal }}次（成功{{ detailsData?.order?.afterSaleSuccessTotal }}次）
    </nz-descriptions-item>
  </nz-descriptions>
</nz-card>

<nz-card class="m-t-4">
  <nz-descriptions
    nzTitle="退款信息"
    [nzSize]="descriptionSize"
    [nzColumn]="descriptionColumn"
  >
    <nz-descriptions-item nzTitle="退款金额">
      ￥ {{ detailsData?.refundPrice || '-' }}
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="退款爱豆">
      {{ detailsData?.refundAiDouAmount || '-' }}
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="退款状态">
      {{ detailsData?.refundState | secondRefundPrice }}
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="第三方编号">-</nz-descriptions-item>
  </nz-descriptions>

  <ng-container *ngFor="let item of detailsData?.flowTraces; let index = index;">
    <nz-divider></nz-divider>
     
    <nz-descriptions
      [nzTitle]="'处理结果' + (index + 1)"
      [nzSize]="descriptionSize"
      [nzColumn]="descriptionColumn"
    >
      <nz-descriptions-item nzTitle="处理人">
        {{ item?.auditUser }}（{{ item?.phone }}）
      </nz-descriptions-item>
      <nz-descriptions-item nzTitle="处理时间">{{ item?.auditTime || '-' }}</nz-descriptions-item>
      <nz-descriptions-item nzTitle="发货单号" *ngIf="item.agreeType === 1">
        {{ detailsData?.refundExpress?.expressNum || '-' }}
      </nz-descriptions-item>
      <nz-descriptions-item nzTitle="物流公司" *ngIf="item.agreeType === 1">
        {{ detailsData?.refundExpress?.expressName || '-' }}
      </nz-descriptions-item>
      <nz-descriptions-item nzTitle="处理结果">
        <span [ngStyle]="{'color': item.agreeType === 0 ? '#52c41a' : '#ff4d4f'}">
          {{ item.agreeType === 0 ? '同意' : (item.agreeType === 1 ? '不同意' : '-' ) }}
        </span>
      </nz-descriptions-item>
      <nz-descriptions-item nzTitle="拒绝原因">
        {{ item.refuseReason || '-' }}
      </nz-descriptions-item>
      <nz-descriptions-item nzTitle="处理备注" nzSpan="2">
        {{ item.auditNote || '-' }}
      </nz-descriptions-item>
      <nz-descriptions-item nzTitle="图片附件" *ngIf="item.agreeType === 1">
        <nz-image-group class="detail-imgs" *ngIf="detailsData?.imgs2">
          <ng-container *ngFor="let img of getImgArray(detailsData?.imgs2)">
            <span class="detail-imgs-item">
              <img
                nz-image
                width="40px"
                height="40px"
                [nzSrc]="img"
                alt=""
              />
            </span>
          </ng-container>
        </nz-image-group>
      </nz-descriptions-item>
    </nz-descriptions>
  </ng-container>
</nz-card>

<nz-card class="m-t-4">
  <p class="details-title">售后内容</p>
  <nz-table
    #afterSaleTable
    nzBordered
    nzSize="small"
    [nzShowPagination]="false"
    [nzData]="saleAfterTable">
    <thead>
      <tr>
        <th nzAlign="left">商品信息</th>
        <th nzAlign="center" nzWidth="140px">购买单价</th>
        <th nzAlign="center" nzWidth="140px">优惠分摊</th>
        <th nzAlign="center" nzWidth="140px">本次售后小计</th>
        <th nzAlign="center" nzWidth="140px">售后成功次数</th>
        <th nzAlign="center" nzWidth="140px">已退货</th>
        <!-- <th nzAlign="center" nzWidth="140px">本次售后</th> -->
      </tr>
    </thead>
    <tbody>
      <tr
        *ngFor="let data of afterSaleTable.data"
        [ngStyle]="{'color': data.afterSaleNum > 0 ? '#F56C6C' : '#C0C4CC'}">
        <!-- 商品信息 -->
        <td nzAlign="left">
          <img
            nz-image
            width="42px"
            height="42px"
            [nzSrc]="data.icon"
            [nzFallback]="fallback"
            alt=""
          />
          <span class="p-l-8">{{ data.goodsName }}</span>
        </td>
        <!-- 购买单价 -->
        <td nzAlign="center">￥ {{ data.price || '0' }}</td>
        <!-- 优惠分摊 -->
        <td nzAlign="center">￥ {{ data.favorablePrice || '0' }}</td>
        <!-- 本次售后小计 -->
        <td nzAlign="center">
          ￥ {{ (data.price || 0) - (data.favorablePrice || 0) }}
        </td>
        <!-- 售后成功次数 -->
        <td nzAlign="center">{{ data.returnTotal || '0' }}</td>
        <!-- 已退货 -->
        <td nzAlign="center">
          {{ data.returnNum > 0 ? '是' : '否' }}
        </td>
        <!-- 本次售后 -->
        <!-- <td nzAlign="center">
          {{ data.afterSaleNum > 0 ? '是' : '否' }}
        </td> -->
      </tr>

      <tr class="sum-tr" *ngIf="saleAfterTable?.length">
        <td nzAlign="center">合计</td>
        <td nzAlign="center">￥ {{ calculatePriceTotal(saleAfterTable, ['price']) }}</td>
        <td nzAlign="center">￥ {{ calculatePriceTotal(saleAfterTable, ['favorablePrice']) }}</td>
        <td nzAlign="center">￥ {{ calculatePriceTotal(saleAfterTable, ['price', 'favorablePrice']) }}</td>
        <td nzAlign="center">× {{ calculatePriceTotal(saleAfterTable, ['returnTotal']) }}</td>
        <td nzAlign="center">× {{ calculateNumTotal('returnNum') }}</td>
        <!-- <td nzAlign="center">× {{ calculateNumTotal('afterSaleNum') }}</td> -->
      </tr>
    </tbody>
  </nz-table>
</nz-card>

<nz-card class="m-t-4">
  <p class="details-title">
    订单售后记录
    <span class="details-sub-title">（和本订单有关的所有售后记录）</span>
  </p>
  <nz-table
    #lastTable
    nzBordered
    nzSize="small"
    [nzShowPagination]="false"
    [nzData]="detailsData?.afterSales">
    <thead>
      <tr>
        <th nzAlign="center">申请时间</th>
        <th nzAlign="center">当前状态</th>
        <th nzAlign="center">售后方式</th>
        <th nzAlign="center">售后单号</th>
        <th nzAlign="center">退款金额</th>
        <th nzAlign="center">返还爱豆</th>
        <th nzAlign="center">操作</th>
      </tr>
    </thead>
    <tbody>
      <tr *ngFor="let data of lastTable.data">
        <!-- 申请时间 -->
        <td nzAlign="center">{{ data.createTime || '-' }}</td>
        <!-- 当前状态 -->
        <td nzAlign="center">
          <span [ngStyle]="{'color': data?.status | secondSaleAfterStatus: 'color'}">
            {{ data?.status | secondSaleAfterStatus: 'label' }}
          </span>
        </td>
        <!-- 售后方式 -->
        <td nzAlign="center">
          {{ data.type | secondSaleAfterMode: 'label' }}
        </td>
        <!-- 售后单号 -->
        <td nzAlign="center">
          <a
            nz-button
            nzType="link"
            nzSize="small"
            [disabled]="!data.returnNum"
            target="_blank"
            routerLink="/used-store/used-after-sales-detatils"
            [queryParams]="{id: data.id}"
          >
            {{ data.returnNum || '-' }}
          </a>
        </td>
        <!-- 退款金额 -->
        <td nzAlign="right">￥ {{ data.refundPrice || '0' }}</td>
        <!-- 返还爱豆 -->
        <td nzAlign="right">￥ {{ data.refundAiDouAmount || '0' }}</td>
        <!-- 操作 -->
        <td nzAlign="center">
          <button
            nz-button
            nzType="link"
            nzSize="small"
            (click)="followModal(data.returnNum)"
          >跟进信息</button>
        </td>
      </tr>

      <tr class="sum-tr" *ngIf="detailsData?.afterSales?.length">
        <td nzAlign="center" colSpan="4">合计</td>
        <!-- 退还金额 -->
        <td nzAlign="right">￥ {{ calculatePriceTotal(detailsData?.afterSales, ['refundPrice']) }}</td>
        <!-- 返还爱豆 -->
        <td nzAlign="right">￥ {{ calculatePriceTotal(detailsData?.afterSales, ['refundAiDouAmount']) }}</td>
        <td nzAlign="center">-</td>
      </tr>
    </tbody>
  </nz-table>
</nz-card>

<nz-card class="m-t-4">
  <div nz-row nzJustify="center" nzAlign="middle">
    <button
      *ngIf="permission.userPermission.has('secondSaleAfter:list:handle') && [0].includes(detailsData.status)"
      nz-button
      nzType="primary"
      (click)="showAfterTreatmentModal()"
    >申请审核</button>

    <button
      *ngIf="permission.userPermission.has('secondSaleAfter:list:handle') && [1,2,3].includes(detailsData.status)"
      nz-button
      nzType="primary"
      class="m-l-10"
      (click)="showLogisticsModal()"
    >修改物流信息</button>

    <button
      *ngIf="permission.userPermission.has('secondSaleAfter:list:handle') && [3].includes(detailsData.status)"
      nz-button
      nzType="primary"
      class="m-l-10"
      (click)="showReceiving()"
    >售后收货</button>

    <button
      *ngIf="permission.userPermission.has('secondSaleAfter:list:handle') && [4].includes(detailsData.status)"
      nz-button
      nzType="primary"
      class="m-l-10"
      (click)="showGoodsAuditingModal()"
    >商品审核</button>

    <button
      nz-button
      nzType="primary"
      class="m-l-10"
      (click)="followModal(detailsData.returnNum)"
    >跟进</button>

    <button
      nz-button
      nzType="default"
      class="m-l-10"
      (click)="back()"
    >返回列表</button>
  </div>
</nz-card>

<!-- 跟进Component -->
<app-follow-up #followUpRef [initParams]="initParams" [ohterParams]="{ type: 1 }"></app-follow-up>

<!-- S 修改物流 Modal -->
<nz-modal
  nzClassName="custom-model-wrap"
  [nzFooter]="null"
  [(nzVisible)]="logisticsVisible"
  [nzTitle]="'修改物流信息'"
  (nzOnCancel)="logisticsVisible = false">

  <div *nzModalContent>
    <div class="custom-model-body">
      <form nz-form [formGroup]="logisticsForm">
        <nz-form-item>
          <nz-form-label [nzSpan]="5" nzRequired>物流公司</nz-form-label>
          <nz-form-control [nzSpan]="19" nzErrorTip="请选择物流公司!">
            <nz-select
              nzShowSearch
              nzAllowClear
              nzPlaceHolder="请选择物流公司"
              formControlName="expressType">
              <nz-option
                *ngFor="let option of logisticsOptions"
                [nzLabel]="option.name"
                [nzValue]="option.content"
              ></nz-option>
            </nz-select>
          </nz-form-control>
        </nz-form-item>

        <nz-form-item>
          <nz-form-label [nzSpan]="5" nzRequired>物流单号</nz-form-label>
          <nz-form-control [nzSpan]="19" nzErrorTip="请输入物流单号!">
            <input
              nz-input
              placeholder="请输入物流单号"
              formControlName="expressNum"
            />
          </nz-form-control>
        </nz-form-item>
      </form>
    </div>

    <div class="custom-model-foot">
      <div class="custom-foot-cont">
        <button nz-button nzType="default" (click)="logisticsVisible = false">取消</button>
        <button nz-button nzType="primary" (click)="subLogisticsForm()">确定</button>
      </div>
    </div>
  </div>
</nz-modal>
<!-- E 修改物流 Modal -->

<!-- S 申请审核 Modal -->
<nz-modal
  nzClassName="custom-model-wrap"
  [nzFooter]="null"
  [(nzVisible)]="afterTreatmentVisible"
  [nzTitle]="'申请审核'"
  (nzOnCancel)="afterTreatmentVisible = false">

  <div *nzModalContent>
    <div class="custom-model-body">
      <form nz-form [formGroup]="afterTreatmentForm">
        <nz-form-item>
          <nz-form-label [nzSpan]="5">售后方式</nz-form-label>
          <nz-form-control [nzSpan]="19">
            {{ detailsData.type | secondSaleAfterMode: 'label' }}
          </nz-form-control>
        </nz-form-item>

        <nz-form-item>
          <nz-form-label [nzSpan]="5">退款原因</nz-form-label>
          <nz-form-control [nzSpan]="19">
            {{ detailsData?.note || '-' }}
          </nz-form-control>
        </nz-form-item>

        <nz-form-item>
          <nz-form-label [nzSpan]="5" nzRequired>处理意见</nz-form-label>
          <nz-form-control [nzSpan]="19" nzErrorTip="请选择处理意见!">
            <nz-radio-group
              formControlName="agreeType"
              (ngModelChange)="afterHandleTypeChange($event)">
              <label nz-radio [nzValue]="0">同意</label>
              <label nz-radio [nzValue]="1">不同意</label>
            </nz-radio-group>
          </nz-form-control>
        </nz-form-item>

        <nz-form-item *ngIf="afterTreatmentForm.value.agreeType === 0 && detailsData.type !== 4">
          <nz-form-label [nzSpan]="5" nzRequired>退货地址</nz-form-label>
          <nz-form-control [nzSpan]="19" nzErrorTip="请选择退货地址!">
            <p class="tips-p p-b-4">※ 退货地址将发送给用户</p>

            <!-- <div ngDefaultControl formControlName="addrId">
              <app-city-select
                [countyId]="afterTreatmentForm.value.addrId"
                (cityChange)="cityChange($event)"
              ></app-city-select>
            </div> -->
            <nz-select
              nzShowSearch
              nzAllowClear
              nzPlaceHolder="请选择退货地址"
              formControlName="addrId">
              <nz-option
                *ngFor="let option of addressOptions"
                nzCustomContent
                [nzValue]="option.id"
                [nzLabel]="option.region">
                <p>{{ option.name }}</p>
                <p>{{ option.region }}</p>
              </nz-option>
            </nz-select>
          </nz-form-control>
        </nz-form-item>

        <nz-form-item *ngIf="afterTreatmentForm.value.agreeType === 1">
          <nz-form-label [nzSpan]="5" nzRequired>拒绝原因</nz-form-label>
          <nz-form-control [nzSpan]="19" nzErrorTip="请选择拒绝原因!">
            <nz-select
              nzShowSearch
              nzAllowClear
              nzPlaceHolder="请选择拒绝原因"
              formControlName="refuseReason">
              <nz-option
                *ngFor="let option of refuseReasonOptions"
                [nzLabel]="option.name"
                [nzValue]="option.name"
              ></nz-option>
            </nz-select>
          </nz-form-control>
        </nz-form-item>

        <nz-form-item *ngIf="afterTreatmentForm.value.agreeType === 1">
          <nz-form-label [nzSpan]="5" nzRequired>备注</nz-form-label>
          <nz-form-control [nzSpan]="19" nzErrorTip="请输入备注!">
            <nz-textarea-count [nzMaxCharacterCount]="100">
              <textarea
                rows="4"
                maxlength="100"
                nz-input
                placeholder="用户可见，请注意言辞"
                formControlName="auditNote"
              ></textarea>
            </nz-textarea-count>
          </nz-form-control>
        </nz-form-item>

        <nz-form-item>
          <nz-form-label [nzSpan]="5" [nzRequired]="afterTreatmentForm.value.agreeType === 1">跟进备注</nz-form-label>
          <nz-form-control [nzSpan]="19" nzErrorTip="请输入跟进备注!">
            <nz-textarea-count [nzMaxCharacterCount]="100">
              <textarea
                rows="4"
                maxlength="100"
                nz-input
                placeholder="自动生成跟进信息，用户不可见"
                formControlName="followText"
              ></textarea>
            </nz-textarea-count>
          </nz-form-control>
        </nz-form-item>
      </form>
    </div>

    <div class="custom-model-foot">
      <div class="custom-foot-cont">
        <button nz-button nzType="default" (click)="afterTreatmentVisible = false">取消</button>
        <button nz-button nzType="primary" (click)="subAfterTreatmentForm()">确定</button>
      </div>
    </div>
  </div>
</nz-modal>
<!-- E 申请审核 Modal -->

<!-- S 商品审核 Modal -->
<nz-modal
  nzClassName="custom-model-wrap"
  [nzFooter]="null"
  [(nzVisible)]="goodsAuditingVisible"
  [nzTitle]="'商品审核'"
  (nzOnCancel)="goodsAuditingVisible = false">

  <div *nzModalContent>
    <div class="custom-model-body">
      <p class="tip-ps-tp" *ngIf="detailsData?.order?.renewalNo">※ 温馨提示：当前订单是以旧换机订单，请确认核对换机补贴再退款</p>

      <form nz-form [formGroup]="goodsAuditingForm">
        <nz-form-item>
          <nz-form-label [nzSpan]="5" nzRequired>处理意见</nz-form-label>
          <nz-form-control [nzSpan]="19" nzErrorTip="请选择处理意见!">
            <nz-radio-group
              formControlName="agreeType"
              (ngModelChange)="handleOpinionsChange($event)">
              <label nz-radio [nzValue]="0">同意</label>
              <label nz-radio [nzValue]="1">不同意</label>
            </nz-radio-group>
          </nz-form-control>
        </nz-form-item>

        <!-- S 处理意见：同意 -->
        <ng-container *ngIf="goodsAuditingForm.value.agreeType === 0">
          <nz-form-item>
            <nz-form-label [nzSpan]="5" nzRequired>售后方式</nz-form-label>
            <nz-form-control [nzSpan]="19" nzErrorTip="请选择售后方式!">
              <nz-radio-group formControlName="refundType">
                <label
                  *ngFor="let option of saleAfterModeOptions"
                  nz-radio
                  [nzValue]="option.value"
                >{{ option.label }}</label>
              </nz-radio-group>
            </nz-form-control>
          </nz-form-item>
  
          <nz-form-item>
            <nz-form-label [nzSpan]="5" nzRequired>退还金额</nz-form-label>
            <nz-form-control [nzSpan]="19" nzErrorTip="请输入退还金额!">
              <nz-input-number
                style="width: 50%;"
                formControlName="refundPrice"
                [nzMin]="0"
                [nzStep]="1"
                [nzPrecision]="0"
                nzPlaceHolder="请输入退还金额"
              ></nz-input-number>

              <p class="tips-p p-t-6" [innerHtml]="detailsData?.refundTipText | domHtml">
                <!-- {{ detailsData?.refundTipText || '' }} -->
              </p>
            </nz-form-control>
          </nz-form-item>
        </ng-container>
        <!-- E 处理意见：同意 -->

        <!-- S 处理意见：不同意 -->
        <ng-container *ngIf="goodsAuditingForm.value.agreeType === 1">
          <nz-form-item>
            <nz-form-label [nzSpan]="5" nzRequired>拒绝原因</nz-form-label>
            <nz-form-control [nzSpan]="19" nzErrorTip="请选择拒绝原因!">
              <nz-select
                nzShowSearch
                nzAllowClear
                nzPlaceHolder="请选择拒绝原因"
                formControlName="refuseReason">
                <nz-option
                  *ngFor="let option of refuseReasonOptions"
                  [nzLabel]="option.name"
                  [nzValue]="option.name"
                ></nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
  
          <nz-form-item>
            <nz-form-label [nzSpan]="5" nzRequired>拒绝备注</nz-form-label>
            <nz-form-control [nzSpan]="19" nzErrorTip="请输入拒绝备注!">
              <nz-textarea-count [nzMaxCharacterCount]="100">
                <textarea
                  rows="4"
                  maxlength="100"
                  nz-input
                  placeholder="用户可见，请注意言辞"
                  formControlName="auditNote"
                ></textarea>
              </nz-textarea-count>
            </nz-form-control>
          </nz-form-item>

          <nz-form-item>
            <nz-form-label [nzSpan]="5">图片附件</nz-form-label>
            <nz-form-control [nzSpan]="19">
              <zdy-upload
                [(ngModel)]="auditingImgList"
                [limitSize]="5"
                [multiple]="true"
                [uploadSize]="80"
                [ngModelOptions]="{standalone: true}"
                (uploadImgChange)="uploadImgChange($event)"
              ></zdy-upload>
            </nz-form-control>
          </nz-form-item>
  
          <nz-form-item>
            <nz-form-label [nzSpan]="5" nzRequired>邮费承担</nz-form-label>
            <nz-form-control [nzSpan]="19" nzErrorTip="请选择邮费承担!">
              <nz-radio-group formControlName="isFreight">
                <label nz-radio [nzValue]="0">我司承担</label>
                <label nz-radio [nzValue]="1">用户承担</label>
              </nz-radio-group>
            </nz-form-control>
          </nz-form-item>
        </ng-container>
        <!-- E 处理意见：不同意 -->

        <nz-form-item>
          <nz-form-label [nzSpan]="5" [nzRequired]="goodsAuditingForm.value.agreeType === 1">跟进备注</nz-form-label>
          <nz-form-control [nzSpan]="19" nzErrorTip="请输入跟进备注!">
            <nz-textarea-count [nzMaxCharacterCount]="100">
              <textarea
                rows="4"
                maxlength="100"
                nz-input
                placeholder="自动生成跟进信息，用户不可见"
                formControlName="followText"
              ></textarea>
            </nz-textarea-count>
          </nz-form-control>
        </nz-form-item>
      </form>
    </div>

    <div class="custom-model-foot">
      <div class="custom-foot-cont">
        <button nz-button nzType="default" (click)="goodsAuditingVisible = false">取消</button>
        <button nz-button nzType="primary" (click)="subGoodsAuditingForm()">确定</button>
      </div>
    </div>
  </div>
</nz-modal>
<!-- E 商品审核 Modal -->

<!-- S 物流详情 Modal -->
<nz-modal
  [(nzVisible)]="logisticsDetailsVisible"
  nzTitle="物流详情"
  [nzFooter]="null"
  (nzOnCancel)="logisticsDetailsVisible = false">
  <ng-container *nzModalContent>
    <ng-container *ngIf="logisticsDetailsArr.length;else templateWl">
      <nz-timeline *ngFor="let item of logisticsDetailsArr">
        <nz-timeline-item>
          <p class="logistics-item">
            {{ item.station || '-' }}
            <span class="logistics-item-time">{{ item.time || '----' }}</span>
          </p>
        </nz-timeline-item>
      </nz-timeline>
    </ng-container>

    <ng-template #templateWl>
      <nz-empty></nz-empty>
    </ng-template>
  </ng-container>
</nz-modal>
<!-- E 物流详情 Modal -->